package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.ShareProfitDirectCollection;
import com.sc.nft.mapper.ShareProfitDirectCollectionMapper;
import  com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (sc_share_profit_direct_collection)数据DAO
 *
 * @author zxy
 * @since 2023-12-09 17:52:41
 * @description 商户banner
 */
@Slf4j
@Repository
public class ShareProfitDirectCollectionDao extends ServiceImpl<ShareProfitDirectCollectionMapper, ShareProfitDirectCollection> {

    public void clearByPanelId(Long panelId){
        lambdaUpdate().eq(ShareProfitDirectCollection::getPanelId,panelId).remove();
    }


    public List<Long> getCollectionIdsByPanelId(Long panelId){
        LambdaQueryWrapper<ShareProfitDirectCollection> wrapper = Wrappers.lambdaQuery();
        wrapper.select(ShareProfitDirectCollection::getCollectionId);
        wrapper.eq(ShareProfitDirectCollection::getPanelId,panelId);
        return listObjs(wrapper,(x)->(Long)x);
    }

}